<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>

    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />

    <title>后台信息管理系统</title>

    <link th:href="@{/css/bootstrap.min.css}" rel="stylesheet" />
    <link th:href="@{/font-awesome/css/font-awesome.css}" rel="stylesheet" />

    <!-- Toastr style -->
    <link th:href="@{/css/plugins/toastr/toastr.min.css}" rel="stylesheet"/>

    <link th:href="@{/css/style.css}" rel="stylesheet" />

    <!-- summernote style -->
    <link th:href="@{/css/plugins/summernote/summernote.css}" rel="stylesheet" />
    <link th:href="@{/css/plugins/summernote/summernote-bs3.css}" rel="stylesheet" />

</head>

<body>

<div id="wrapper">
    <nav class="navbar-default navbar-static-side" role="navigation" th:include="nav :: navigation"></nav>
    <div id="page-wrapper" class="gray-bg">
        <div class="border-bottom" th:include="header :: headerTop"></div>
        <div class="row wrapper border-bottom white-bg page-heading" th:fragment="headerNav">
            <div class="col-lg-10">
                <h2>网站详情</h2>
                <ol class="breadcrumb">
                    <li>
                        <a href="#">首页</a>
                    </li>
                    <li>
                        <a>用户管理</a>
                    </li>
                    <li>
                        <a>网站管理</a>
                    </li>
                    <li class="active">
                        <strong>详情新增或修改</strong>
                    </li>
                </ol>
            </div>
            <div class="col-lg-2">
            </div>

            <div class="row">
                <div class="col-sm-6 m-b-xs">
                    <a th:href="@{'configEdit'}" class="btn btn-primary btn-sm" data-toggle="tooltip" data-placement="left" title="" data-original-title="Refresh inbox"><i class="fa fa-plus"></i>&nbsp;&nbsp;&nbsp;&nbsp;新增详情&nbsp;&nbsp;&nbsp;&nbsp;</a>
                </div>
                <div class="col-sm-6 m-b-xs">
                </div>
            </div>

        </div>
        <div class="wrapper wrapper-content animated fadeInRight">
            <div class="row">
                <div class="col-lg-12">


                            <form id="formTag" action="config" method="POST" class="form-horizontal" enctype="multipart/form-data">

                                <div class="col-lg-12">
                                    <div class="ibox float-e-margins">
                                        <div class="ibox-title">
                                            <h5>网站详情</h5>
                                            <div class="ibox-tools">
                                                <a class="collapse-link">
                                                    <i class="fa fa-chevron-up"></i>
                                                </a>
                                            </div>
                                        </div>
                                        <div class="ibox-content">
                                            <div class="table-responsive">
                                                <table class=" table table-hover" data-page-size="10">
                                                    <thead>
                                                    <tr>
                                                        <th width="10%">ID</th>
                                                        <th width="10%">name</th>
                                                        <th width="10%">中文名</th>
                                                        <th width="10%">详情</th>
                                                        <th width="10%">rate值</th>
                                                        <!--<th width="10%">推荐状态</th>-->
                                                        <th>操作</th>
                                                    </tr>
                                                    </thead>
                                                    <tbody>
                                                    <tr th:each="config : ${config}">
                                                        <td th:text="${config.id}">Onions</td>
                                                        <td th:text="${config.name}">Onions</td>
                                                        <td th:text="${config.cname}">Onions</td>
                                                        <td th:text="${config.value}">Onions</td>
                                                        <td th:text="${config.rate}">Onions</td>
                                                        <td>
                                                            <a th:href="@{'configEdit?id='+${config.id}}" title="修改"><i class="fa fa-edit text-navy"></i></a>
                                                            <a th:href="@{'configDelete/'+${config.id}}" title="删除"><i class="fa fa-trash-o text-navy"></i></a>
                                                        </td>
                                                    </tr>
                                                    </tbody>
                                                    <tfoot>
                                                    <tr>
                                                        <td colspan="8">
                                                            <ul id="pageHTML" class="pagination pull-right"></ul>
                                                        </td>
                                                    </tr>
                                                    </tfoot>
                                                </table>
                                            </div>
                                        </div>
                                    </div>
                                </div>




                                <div class="hr-line-dashed"></div>

                            </form>
                        </div>

                </div>
            </div>

        </div>
        <div class="footer" th:include="footer :: copyright"></div>
    </div>
</div>

<!-- Mainly scripts -->
<script th:src="@{/js/jquery-2.1.1.js}"></script>
<script th:src="@{/js/bootstrap.min.js}"></script>
<script th:src="@{/js/plugins/metisMenu/jquery.metisMenu.js}"></script>
<script th:src="@{/js/plugins/slimscroll/jquery.slimscroll.min.js}"></script>

<!-- Peity -->
<script th:src="@{/js/plugins/peity/jquery.peity.min.js}"></script>

<!-- Custom and plugin javascript -->
<script th:src="@{/js/inspinia.js}"></script>
<script th:src="@{/js/plugins/pace/pace.min.js}"></script>

<!-- Toastr script -->
<script th:src="@{/js/plugins/toastr/toastr.min.js}"></script>

<!-- common -->
<script th:src="@{/js/common.js}"></script>

<!-- SUMMERNOTE -->
<script th:src="@{/js/plugins/summernote/summernote.min.js}"></script>


<script th:inline="javascript">
    $(document).ready(function () {
        //初始化编辑器
        $('#summernote').summernote({
            height: 300,
            codemirror: {
                mode: 'text/html',
                htmlMode: true,
                lineNumbers: true,
                theme: 'monokai'
            }
        });
        //编辑器赋值

        //提交
        $("#submitButton").click(function(){
            if($("#title").val() == ""){
                toastr.error('请输入商品标题','提示');
                return;
            }
            if($("#category").val() == 0){
                toastr.error('请选择商品分类','提示');
                return;
            }
            if($("#price").val() == 0){
                toastr.error('请输入商品价格','提示');
                return;
            }
            if($("#num").val() == 0){
                toastr.error('请输入库存数量','提示');
                return;
            }
            $("#formTag").submit();
        });
    });


     var pageHTML = [[${pageHTML}]];
    $(document).ready(function () {
        $("#pageHTML").html(pageHTML);
    });

    /*<![CDATA[*/
    function updateState(id,state,commendState){
        var deleteTag;
        if(state==2){
            deleteTag = confirm("确定删除此条信息?");
        } else {
            deleteTag = true;
        }
        if(deleteTag){
            $.ajax({
                type: "POST",
                url: "itemEditState?id="+id,
                contentType: "application/json; charset=utf-8",
                success: function(msg){
                    window.location.reload();
                },
                error: function(){
                    alert("系统异常！");
                }
            });
        }
    }
    /*]]>*/
</script>

</body>

</html>
